package ar.fi.uba.fallas2.business.factories;

import java.sql.ResultSet;
import java.sql.SQLException;

import ar.fi.uba.fallas2.business.Answer;
import ar.fi.uba.fallas2.business.GenericFinder;
import ar.fi.uba.fallas2.data.DataException;

public class AnswerFactory {
	public static Answer create(ResultSet rs) throws DataException, SQLException {
		Answer a = new Answer(rs.getInt(1));
		a.setKind(GenericFinder.findKindById(rs.getInt(2)));
		a.setObject(GenericFinder.findGuessObjectById(rs.getInt(3)));
		a.setQuestion(GenericFinder.findQuestionById(rs.getInt(4)));
		a.setWeight(rs.getInt(5));
		return a;
	}
}
